13. Exercise: Hello Android
L1 31 Activity And Layout Code SC 1
Now it’s your turn to complete this exercise.
In this exercise, you will modify the text shown on the screen to say Hello Android.
**1. Open the MainActivity layout file and change the “Hello World!” to “Hello Android!”: **
You can do this by changing the text attribute in the XML:
android:text="Hello Android"
No other changes are needed! Since this exercise was so quick, we don't have a code step. But your final activity_main.xml code should look like:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello Android!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Task Description:
Check the steps below as you implement them to complete this exercise.
Task Feedback:
Well done!
Now it’s time to start building our Dice Roller app.
Reference documentation